#ifndef TRACKBALL_H
#define TRACKBALL_H

#include "quaternion.h"

namespace visualization
{
	/*
	* This size should really be based on the distance from the center of
	* rotation to the point on the object underneath the mouse.  That
	* point would then track the mouse as closely as possible.  This is a
	* simple example, though, so that is left as an Exercise for the
	* Programmer.
	*/
	static const double TRACKBALLSIZE = 0.8f;
	static const int RENORMCOUNT = 97;
	//static int count = 0;

	static const double SQRT2   = 1.41421356237309504880f;
	static const double SQRT2D2 = 0.70710678118654752440f;

	/*
	* Pass the x and y coordinates of the last and current positions of
	* the mouse, scaled so they are from (-1.0 ... 1.0).
	*
	* The resulting rotation is returned as a quaternion rotation in the
	* first parameter.
	*/
	Quaternion Trackball(double p1x, double p1y, double p2x, double p2y);

	/*
	* This function computes a quaternion based on an axis (defined by
	* the given vector) and an angle about which to rotate.  The angle is
	* expressed in radians.  The result is put into the third argument.
	*/
	Quaternion AxisToQuat(Vector &axis, double phi);

}
#endif
